package arithmetic.leetCode.yi;

import java.util.LinkedHashMap;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: yilin
 * Date: 2019-09-05
 * Time: 10:30
 */
public class LruCacheV3 extends LinkedHashMap {


    private static final long serialVersionUID = -7612111868022788186L;
    private int CACHE_SIZE;

    public LruCacheV3(int cashSize) {
        super((int) Math.ceil(cashSize / 0.75 + 1), 0.75F, true);
        this.CACHE_SIZE = cashSize;
    }

    public boolean removeEldestKey() {
        return this.size() > CACHE_SIZE;
    }


}
